package zuoye2;

import zuoye1.MyStack;


import java.util.Iterator;
import java.util.LinkedList;

public class QQ {
    public static void main(String[] args) {
        String[] strs = {"12345", "67891", "12347809933", "98765432102", "67891", "12347809933"};

        LinkedList list = new LinkedList();
        list.add(strs[0]);
        list.add(strs[1]);
        list.add(strs[2]);
        list.add(strs[3]);
        list.add(strs[4]);
        list.add(strs[5]);

        for (int i = 0; i < list.size(); i++) {
            for (int j = i + 1; j < list.size(); j++) {
                if (list.get(i).equals(list.get(j))) {
                    list.remove(j);

                }
            }
        }
        //增强for循环
        for (Object obj : list) {
            String a = (String) obj;
            System.out.println(a);
        }

        System.out.println("------------------------------");

        //迭代器
        Iterator itor=list.iterator();
        while(itor.hasNext()){
            String str=(String)itor.next();
            System.out.println(str);
        }
}
}